package com.mobi.spring1.Sever.impl;

import com.mobi.spring1.Sever.Sever;

import com.mobi.spring1.dao.UserDao;

import com.mobi.spring1.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserSever implements Sever {
    @Autowired
    private UserDao dao;

    private User user;

    @Override
    public void add(Object o) {
        user=(User) o;
        dao.save(user);
    }

    @Override
    public void del(Integer id) {
        dao.deleteById(id);
    }

    @Override
    public void update(Object o) {
        user=(User) o;
        dao.save(user);
    }

    @Override
    public Object findById(Integer id) {
        return dao.findById(id);
    }

    @Override
    public Object findAll() {
        System.out.println(dao);
        return dao.findAll();
    }
}
